#!/usr/bin/env bash


set -e -u -x
source ./tasks/helpers.sh

shellcheck_version="0.10.0"
shellcheck_hash="6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87"

download_arch="$TARGETARCH"
if [ "$TARGETARCH" == "amd64" ]; then
  download_arch="x86_64"
elif [ "$TARGETARCH" == "arm64" ]; then
  download_arch="aarch64"
  shellcheck_hash="324a7e89de8fa2aed0d0c28f3dab59cf84c6d74264022c00c22af665ed1a09bb"
fi

task_working_dir
download "https://github.com/koalaman/shellcheck/releases/download/v$shellcheck_version/shellcheck-v$shellcheck_version.linux.${download_arch}.tar.xz" "sha256" "$shellcheck_hash"
extract_download "shellcheck-v$shellcheck_version.linux.${download_arch}.tar.xz"

install -D -m 755 "shellcheck-v$shellcheck_version/shellcheck" "$TEST_INSTALL_PREFIX/bin/shellcheck"

stamp
